﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace V5_EaspLibs.Core {
    /// <summary>
    /// Debug调试帮助类
    /// </summary>
    public class DebugHelper {
        private static readonly DebugHelper m_Instance = new DebugHelper();
        /// <summary>
        /// 
        /// </summary>
        public static DebugHelper Instance {
            get { return m_Instance; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DebugHelper() {

        }
        /// <summary>
        /// 输出数据列名称
        /// </summary>
        /// <param name="typeName">类型为 DataRow  DataTable</param>
        /// <param name="o">DataRow  DataTable 对象</param>
        /// <returns></returns>
        public string OutColName(string typeName, object o) {
            string tempString = string.Empty;
            switch (typeName.ToLower()) {
                case "datarow":
                    DataRow dr = (DataRow)o;
                    foreach (DataColumn dc in dr.Table.Columns) {
                        tempString += " " + dc.ColumnName;
                    }
                    break;
                case "datatable":
                    DataTable dt = (DataTable)o;
                    foreach (DataColumn dc in dt.Columns) {
                        tempString += " " + dc.ColumnName;
                    }
                    break;
            }
            return tempString;
        }
    }
}
